<?php
session_cache_expire(999999999);
if(!isset($_SESSION)) 
	{ 
		session_start(); 
	}

if(isset($_SESSION['lang']))
			$lang = $_SESSION['lang'];	
if (empty($lang) || $lang == "EN") {
	$value = "../value/value_en.php";
} else if($lang == "VN") {
	$value = "../value/value_vn.php";
}
else {
	$value = "../value/value_kr.php";
}
include($value);
$id_contractw=$_REQUEST["id_contractw"];

include '../operations/connection.php';

$contractwd= array();
$result = mysql_query("SELECT * FROM contract_warranty_detail d WHERE d.id_contract='$id_contractw' AND d.isDelete=0");
while ($r = mysql_fetch_array($result)) {
    	$contractwd[] = array($r['id'],$r['name'],$r['startDay'],$r['endDay'],$r['price'],$r['company'],$r['note']);
}
?>
<?=$l_listcontractwarranty1?>
                                	<br>
	                                <table cellpadding="0" cellspacing="1" border="0" class="ftable1" style="padding: 0 5px 0 10px; margin-top: 10px;">
	                                    <tr>
	                                        <th style="width: 30px"><img onclick="showaddOneRow1('<?=$id_contractw?>')" src="images/plus.png" style="width:20px;height:20px;cursor:pointer;" title="<?=$l_add?>"></th>
	                                        <th style="width: 30px"></th>
	                                        <th style="width: 200px"><?=$l_name_contractwarranty1?></th>
	                                        <th style="width: 110px"><?=$l_startDay?></th>
	                                        <th style="width: 110px"><?=$l_endDay?></th>
	                                        <th style="width: 120px"><?=$l_totalValue_contractwarranty1?></th>
	                                        <th style="width: 100px"><?=$l_nameCompany_contractwarranty?></th>
	                                        <th style="width: 80px"><?=$l_note?></th>
	                                    </tr> 
	                                    <?php
	                                            $i = 0;
	                                            foreach ($contractwd as $value => $giatri) {
	                                                ?>
	                                        <tr>
	                                            <td><?= $i + 1 ?></td>
	                                            <td><img onclick="delOneRow1('<?=$giatri[0]?>','<?=$id_contractw?>');" src="images/del.png" style="width:20px;height:20px;cursor:pointer;" title="<?=$l_delete?>"></td>
	                                            <td style="text-align: left;padding-left: 10px;"><a onclick="showeditOneRow1('<?=$giatri[0]?>','<?=$id_contractw?>')"><?php echo $giatri[1]; ?></a></td>
	                                            <td style="text-align: left;padding-left: 10px;"><?php echo $giatri[2]; ?></td>
	                                            <td style="text-align: left;padding-left: 10px;"><?php echo $giatri[3]; ?></td>
	                                            <td style="text-align: left;padding-left: 10px;"><?php echo number_format($giatri[4]); ?></td>
	                                            <td style="text-align: left;padding-left: 10px;"><?php echo $giatri[5]; ?></td>
	                                            <td style="text-align: left;padding-left: 10px;"><?php echo $giatri[6]; ?></td>
	                                        </tr>
										<?php
										    		$i++;
												}
										?>	
										<?php if($i==0){?>
	                                  	<tr><td colspan="9" style="text-align: left;"><?=$l_list_emplty?></td></tr>
	                                    <?php }?>
	                                </table>

<?php mysql_close($connection);?>